
import java.util.Vector;
import java.util.Collections;

class OWA{
    protected Vector<Float> v_weight;
    protected Vector<Float> v_values;
    
    public OWA(){
	this.v_weight = new Vector();
	this.v_values = new Vector();
    }

    public void addWeight(float w){
	this.v_weight.addElement(w);
    }
    public void addValue(float v){
	this.v_values.addElement(v);
    }

    public float calculateValue(){
	float result = 0;
	
	Collections.sort(v_values);

	for(int i=0;i<v_values.size();i++){
	    result += v_values.elementAt(i)*v_weight.elementAt(i);
	}
	return result;
    }
}//end class